<template>
    <div class="setup-form" @click="highlight_i = ''">
        <el-form
            ref="form"
            :model="form"
            :label-width="labelWidthall"
            :rules="rules"
        >
            <el-tabs v-model="activeName">
                <el-tab-pane label="云店信息" name="1">
                    <div class="tab-box comm-list">
                        <div class="module-title">基本选项</div>
                        <el-form-item
                            label="云店logo"
                            :class="
                                highlight_i === action.logo ? 'highlight' : ''
                            "
                        >
                            <div class="img-context">
                                <div class="img-box">
                                    <addPhoto
                                        ref="AddPhotoLogo"
                                        :pList="form.logo"
                                        :batchid="'enterprise_logo'"
                                        :idyun="idyun"
                                        actType="5"
                                        @uploadAavatar="uploadAavatar"
                                    ></addPhoto>
                                </div>
                                <div class="img-but">
                                    <div class="but">
                                        <el-button
                                            type="primary"
                                            size="mini"
                                            icon="el-icon-plus"
                                            @click="
                                                replaceImg(
                                                    form.logo[0].url,
                                                    'enterprise_logo'
                                                )
                                            "
                                            >上传替换</el-button
                                        >
                                    </div>
                                    <div class="tis">
                                        请上传jpg, bmp, png, gif格式的图片
                                    </div>
                                </div>
                            </div>
                        </el-form-item>
                        <el-form-item
                            label="店铺名称"
                            :class="
                                highlight_i === action.shopName
                                    ? 'highlight'
                                    : ''
                            "
                            prop="name"
                        >
                            <el-input
                                v-model="form.name"
                                placeholder="请输入店铺名称"
                                @input="
                                    inputHandler({
                                        act: action.shopName,
                                        data: { name: form.name },
                                    })
                                "
                            >
                            </el-input>
                        </el-form-item>
                        <el-form-item
                            label="电话"
                            prop="cellphone"
                            :class="
                                highlight_i === action.phone ? 'highlight' : ''
                            "
                        >
                            <el-input
                                v-model="form.cellphone"
                                placeholder="请输入电话"
                                maxlength="11"
                                @input="
                                    inputHandler({
                                        act: action.phone,
                                        data: { cellphone: form.cellphone },
                                    })
                                "
                            >
                            </el-input>
                        </el-form-item>
                        <el-form-item
                            label="联系人"
                            :class="
                                highlight_i === action.contacts
                                    ? 'highlight'
                                    : ''
                            "
                        >
                            <el-input
                                v-model="form.contacts"
                                placeholder="请输入联系人"
                                @input="
                                    inputHandler({
                                        act: action.contacts,
                                        data: { contacts: form.contacts },
                                    })
                                "
                            >
                            </el-input>
                        </el-form-item>
                        <el-form-item
                            label="地址"
                            :class="
                                highlight_i === action.adress2
                                    ? 'highlight'
                                    : ''
                            "
                        >
                            <!-- <el-form-item>
                                <el-radio v-model="form.address_type" label="1"
                                    >地图选点
                                    <span
                                        class="set-population"
                                        v-show="form.address_type == 1"
                                        @click="openMapFun"
                                        :class="
                                            highlight_i === action.adress1
                                                ? 'highlight'
                                                : ''
                                        "
                                        >设置</span
                                    ></el-radio
                                >

                                <el-radio v-model="form.address_type" label="2"
                                    >自定义</el-radio
                                >
                            </el-form-item> -->
                            <div>
                                <el-form-item prop="address">
                                <el-cascader
                                    id="selectPrCtAr"
                                    v-model="form.district"
                                    :options="optionsPosition"
                                    :props="propsdata"
                                    placeholder="省市区"
                                    @change="handleChange"
                                ></el-cascader>
                                <el-input
                                    placeholder="详细地址"
                                    v-model="form.address"
                                    class="input-w-400"
                                    @input="handleChange(form.district)"
                                >
                                </el-input>
                            </el-form-item>
                            <div>
                                <tengxunMapSelect
                                    :addr="addrDetail"
                                    ref="tengxunMapSelect"
                                    @mapLnglat="mapLnglat"
                                ></tengxunMapSelect>
                            </div>
                            </div>
                        </el-form-item>
                        <el-form-item label="介绍内容">
                            <el-form-item>
                                <el-radio v-model="form.jsnr_radio" label="1"
                                    >默认
                                </el-radio>

                                <el-radio v-model="form.jsnr_radio" label="2"
                                    >自定义</el-radio
                                >
                            </el-form-item>
                                    <el-form-item v-show="form.jsnr_radio == 2">
                                <div
                                    class="content-row"
                                    v-for="(item, index) in form.productIntr"
                                    :key="index"
                                    :class="
                                        highlight_i === 'context_intor_' + index
                                            ? 'highlight'
                                            : ''
                                    "
                                >
                                    <span>{{
                                        item && item.title ? item.title : ""
                                    }}</span>
                                    <span
                                        class="see"
                                        @click="setupFun(item, index)"
                                        >编辑插入内容</span
                                    >
                                    <span
                                        class="del"
                                        @click="delFun(item, index)"
                                        >删除</span
                                    >
                                </div>
                            </el-form-item>
                            <el-form-item v-show="form.jsnr_radio == 2">
                                <el-button size="mini" @click="insertFun('1')"
                                    >添加插入团队</el-button
                                >
                                <el-button size="mini" @click="insertFun('2')"
                                    >添加插入纯图</el-button
                                >
                                <el-button size="mini" @click="insertFun('3')"
                                    >添加插入图文</el-button
                                >
                            </el-form-item>
                        </el-form-item>
                    </div>
                </el-tab-pane>
                <el-tab-pane label="营销设置" name="2">
                    <div class="tab-box comm-list">
                        <div class="module-title">基本选项</div>
                        <el-form-item label="店铺轮播图">
                            <span class="set-population" @click="openOrganizer"
                                >查看设置</span
                            >
                        </el-form-item>
                        <el-form-item
                            label="店铺公告"
                            :class="
                                highlight_i === action.shopNotice
                                    ? 'highlight'
                                    : ''
                            "
                        >
                            <el-radio v-model="form.dpgg_radio" label="1"
                                >开启</el-radio
                            >
                            <el-radio v-model="form.dpgg_radio" label="2"
                                >关闭
                            </el-radio>
                            <span
                                v-show="form.dpgg_radio == 1"
                                class="set-population"
                                @click="openShopNotices"
                                >查看设置</span
                            >
                        </el-form-item>
                        <div v-if="md === 'asm'">
                            <el-form-item label="快速导航">
                                <el-radio
                                    v-model="form.nav_info.is_open"
                                    label="1"
                                    >开启</el-radio
                                >
                                <el-radio
                                    v-model="form.nav_info.is_open"
                                    label="2"
                                    >关闭
                                </el-radio>
                                <span
                                    v-show="form.nav_info.is_open == 1"
                                    class="set-population"
                                    @click="openQuickNavigation"
                                    >查看设置</span
                                >
                            </el-form-item>
                            <el-form-item label="活动展示">
                                <el-radio
                                    v-model="form.mar_info.is_open"
                                    label="1"
                                    >开启</el-radio
                                >
                                <el-radio
                                    v-model="form.mar_info.is_open"
                                    label="2"
                                    >关闭
                                </el-radio>
                                <span
                                    v-show="form.mar_info.is_open == 1"
                                    class="set-population"
                                    @click="openEventdisplay"
                                    >查看设置</span
                                >
                            </el-form-item>
                            <el-form-item label="产品展示">
                                <el-radio
                                    v-model="form.tag_info.is_open"
                                    label="1"
                                    >开启</el-radio
                                >
                                <el-radio
                                    v-model="form.tag_info.is_open"
                                    label="2"
                                    >关闭
                                </el-radio>
                                <span
                                    v-show="form.tag_info.is_open == 1"
                                    class="set-population"
                                    @click="openCommodityLabel"
                                    >查看设置</span
                                >
                            </el-form-item>
                        </div>

                        <div class="module-title">访问设置</div>
                        <el-form-item label="向游客开放">
                            <el-radio v-model="form.open_yk" label="1"
                                >开启</el-radio
                            >
                            <el-radio v-model="form.open_yk" label="2"
                                >关闭
                            </el-radio>
                            <span class="tis"
                                >关闭时，游客只可以浏览云店店铺介绍</span
                            >
                        </el-form-item>
                        <el-form-item label="登录手机必填">
                            <el-radio v-model="form.is_cellphone" label="1"
                                >开启</el-radio
                            >
                            <el-radio v-model="form.is_cellphone" label="2"
                                >关闭
                            </el-radio>
                            <span class="tis"> 开启时，手机必须验证</span>
                        </el-form-item>
                        <div v-if="is_good">
                            <el-form-item label="老客户产品价格显示">
                                <el-radio v-model="form.is_price" label="2"
                                    >隐藏</el-radio
                                >
                                <el-radio v-model="form.is_price" label="1"
                                    >显示
                                </el-radio>
                                <el-radio v-model="form.is_price" label="3"
                                    >优先报上次价
                                </el-radio>
                                <span class="tis"> 价格隐藏时 不可销售</span>
                            </el-form-item>
                            <el-form-item label="新游客产品价格显示">
                                <el-radio v-model="show_gd_price" label="2"
                                    >隐藏</el-radio
                                >
                                <el-radio v-model="show_gd_price" label="1"
                                    >显示
                                </el-radio>
                                <span class="tis"> 价格隐藏时 不可销售</span>
                                <el-form-item v-show="show_gd_price == 1">
                                    <el-select v-model="form.price_i_yk">
                                        <el-option
                                            v-for="item in optionsGoodpic"
                                            :key="item.psort"
                                            :label="item.title"
                                            :value="item.psort"
                                        >
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-form-item>
                        </div>

                        <div v-if="is_yy">
                            <el-form-item label="老客户服务价格显示">
                                <el-radio v-model="form.yy_is_price" label="2"
                                    >隐藏</el-radio
                                >
                                <el-radio v-model="form.yy_is_price" label="1"
                                    >显示
                                </el-radio>
                                <el-radio v-model="form.yy_is_price" label="3"
                                    >优先报上次价
                                </el-radio>
                                <span class="tis"> 价格隐藏时 不可销售</span>
                            </el-form-item>
                            <el-form-item label="新游客服务价格显示">
                                <el-radio v-model="show_yy_price" label="2"
                                    >隐藏</el-radio
                                >
                                <el-radio v-model="show_yy_price" label="1"
                                    >显示
                                </el-radio>
                                <span class="tis"> 价格隐藏时 不可销售</span>
                                <el-form-item v-show="show_yy_price == 1">
                                    <el-select v-model="form.yy_price_i_yk">
                                        <el-option
                                            v-for="item in optionsProprepic"
                                            :key="item.psort"
                                            :label="item.title"
                                            :value="item.psort"
                                        >
                                        </el-option>
                                    </el-select>
                                </el-form-item>
                            </el-form-item>
                        </div>
                    </div>
                </el-tab-pane>
                <el-tab-pane label="高级设置" name="3">
                    <div class="tab-box comm-list">
                        <div class="module-title">销售设置</div>
                        <el-form-item label="允许超过库存销售">
                            <el-radio v-model="form.is_fqty" label="1"
                                >开启</el-radio
                            >
                            <el-radio v-model="form.is_fqty" label="2"
                                >关闭
                            </el-radio>
                        </el-form-item>
                        <!-- <el-form-item label="是否划线价格">
                            <el-radio v-model="form.is_pricec" label="1"
                                >开启</el-radio
                            >
                            <el-radio v-model="form.is_pricec" label="2"
                                >关闭
                            </el-radio>
                        </el-form-item> -->
                        <el-form-item label="显示销量">
                            <el-radio v-model="form.is_number" label="3"
                                >隐藏</el-radio
                            >
                            <el-radio v-model="form.is_number" label="1"
                                >显示销售数量(最小单位)
                            </el-radio>
                            <el-radio v-model="form.is_number" label="2"
                                >显示销售次数(销售单)
                            </el-radio>
                        </el-form-item>
                        <el-form-item label="显示库存">
                            <el-radio v-model="form.is_qty" label="2"
                                >隐藏</el-radio
                            >
                            <el-radio v-model="form.is_qty" label="1"
                                >开启
                            </el-radio>
                        </el-form-item>
                        <el-form-item label="产品起订量">
                            <el-input
                                v-model="form.num_min"
                                class="input-w-200"
                            >
                            </el-input>
                        </el-form-item>
                        <el-form-item label="最低下单金额">
                            <el-input
                                v-model="form.amount_min"
                                class="input-w-200"
                            >
                            </el-input>
                        </el-form-item>
                        <el-form-item label="下单必须支付">
                            <el-radio v-model="form.must_pay" label="1"
                                >开启</el-radio
                            >
                            <el-radio v-model="form.must_pay" label="2"
                                >关闭
                            </el-radio>
                        </el-form-item>
                        <el-form-item label="下单后立即减库存">
                            <el-radio v-model="form.now_out" label="1"
                                >开启</el-radio
                            >
                            <el-radio v-model="form.now_out" label="2"
                                >关闭
                            </el-radio>
                        </el-form-item>
                        <el-form-item
                            label="单据归属门店"
                            v-if="form.now_out == 1"
                        >
                            <el-select v-model="form.od_in_sp_id">
                                <el-option
                                    v-for="item in shopList"
                                    :key="item.id"
                                    :label="item.name"
                                    :value="item.id"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item
                            label="单据减库存仓库"
                            v-if="form.now_out == 1"
                        >
                            <el-select v-model="form.od_in_st_id">
                                <el-option
                                    v-for="item in storeList"
                                    :key="item.id"
                                    :label="item.name"
                                    :value="item.id"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="下单支付后自动打印单据">
                            <el-radio v-model="form.isprint" label="1"
                                >开启</el-radio
                            >
                            <el-radio v-model="form.isprint" label="2"
                                >关闭
                            </el-radio>
                        </el-form-item>
                        <div class="module-title">支付设置</div>
                        <el-form-item
                            label-width="100px"
                            v-for="item in pay_openls"
                            :key="item.id"
                        >
                            <el-checkbox
                                v-model="form[item.id]"
                                true-label="1"
                                false-label="2"
                                >{{ item.title }}</el-checkbox
                            >
                            <span class="tis ml-tis">{{ item.txt }}</span>
                        </el-form-item>

                        <el-form-item label="在线支付">
                            <el-radio
                                v-model="is_online_pay"
                                label="1"
                                :disabled="md === 'asm'"
                                >开启</el-radio
                            >
                            <el-radio
                                v-model="is_online_pay"
                                :disabled="md === 'asm'"
                                label="2"
                                :style="getboll() ? 'pointer-events:none;' : ''"
                                >关闭
                            </el-radio>
                            <el-form-item v-show="is_online_pay == 1">
                                <el-checkbox-group v-model="form.payls">
                                    <div v-for="item in play_ls" :key="item.id">
                                        <el-checkbox
                                            :label="item.id"
                                            v-if="item.id < 22"
                                            :disabled="md === 'asm'"
                                            :style="
                                                form.payls.length == 1 &&
                                                form.payls.indexOf(item.id) > -1
                                                    ? 'pointer-events:none;'
                                                    : ''
                                            "
                                        >
                                            <span>{{ item.name }}</span>
                                            <span
                                                class="tis ml-tis"
                                                v-if="item.txt"
                                                >{{ item.txt }}</span
                                            >
                                        </el-checkbox>
                                    </div>
                                </el-checkbox-group>
                            </el-form-item>
                        </el-form-item>
                        <el-form-item label="线下支付">
                            <el-form-item>
                                <el-checkbox-group v-model="form.payls">
                                    <div v-for="item in play_ls" :key="item.id">
                                        <el-checkbox
                                            :label="item.id"
                                            v-if="item.id > 21"
                                            :disabled="md === 'asm'"
                                            :style="
                                                form.payls.length == 1 &&
                                                form.payls.indexOf(item.id) > -1
                                                    ? 'pointer-events:none;'
                                                    : ''
                                            "
                                        >
                                            <span>{{ item.name }}</span>
                                            <span
                                                class="tis ml-tis"
                                                v-if="item.txt"
                                                >{{ item.txt }}</span
                                            >
                                        </el-checkbox>
                                    </div>
                                </el-checkbox-group>
                            </el-form-item>
                        </el-form-item>
                        <div class="module-title">配送方式</div>
                        <el-form-item :label="shippObj.name">
                            <el-radio v-model="shipp_now" label="1"
                                >开启</el-radio
                            >
                            <el-radio
                                v-model="shipp_now"
                                label="2"
                                :style="
                                    form.shipp.length == 1 &&
                                    form.shipp.indexOf(shippObj.id) > -1
                                        ? 'pointer-events:none;'
                                        : ''
                                "
                                >关闭
                            </el-radio>
                        </el-form-item>
                        <el-form-item label="其他配送">
                            <el-checkbox-group v-model="form.shipp">
                                <span
                                    :class="item.type == 2 ? 'checkbox-mr' : ''"
                                    v-for="item in shipp_ls"
                                    :key="item.id"
                                >
                                    <el-checkbox
                                        :label="item.id"
                                        v-if="item.type == 2"
                                        :style="
                                            shipp_now == 2 &&
                                            form.shipp.length == 2 &&
                                            form.shipp.indexOf(item.id) > -1
                                                ? 'pointer-events:none;'
                                                : ''
                                        "
                                    >
                                        <span>{{ item.title }}</span>
                                    </el-checkbox>
                                </span>
                            </el-checkbox-group>
                        </el-form-item>
                        <div class="module-title">运费设置</div>
                        <el-form-item label="运费方式">
                            <div>
                                <span class="see" @click="setfreightFun"
                                    >查看设置</span
                                >
                            </div>
                            <div
                                class="checkbox-mr"
                                v-for="item in freight_ls"
                                :key="item.id"
                            >
                                <el-radio v-model="form2.id" :label="item.id">{{
                                    item.title
                                }}</el-radio>
                            </div>
                        </el-form-item>
                    </div>
                </el-tab-pane>
            </el-tabs>
        </el-form>
        <div class="but-box">
            <el-button type="primary" @click="submitFun">保存</el-button>
        </div>
        <!-- 图片裁剪 -->
        <imageCropper
            v-if="
                !is_drawer1 &&
                !is_drawer2 &&
                !is_drawer3 &&
                !is_drawer4 &&
                !is_drawer5
            "
            ref="imageCropper"
            :src="editUrl"
            @confirm="confirm"
            @cancel="cancel"
        >
        </imageCropper>
        <!-- 地图选点 -->
        <popMappointSelection ref="popMappointSelection"></popMappointSelection>
        <!-- 插入团队 -->
        <popInsertTeam
            ref="popInsertTeam"
            @inContentIntro="inContentIntro"
        ></popInsertTeam>
        <!-- 选择跳转链接 -->
        <popJumpLink
            :idyun="idyun"
            ref="popJumpLink"
            :is_yy="is_yy"
            :is_good="is_good"
            :is_xsqg="is_xsqg"
            :is_hdpt="is_hdpt"
            :is_tpbm="is_tpbm"
            :md="md"
        ></popJumpLink>
        <!-- 店铺公告 -->
        <popShopNotices
            ref="popShopNotices"
            :idyun="idyun"
            :form="form"
            :optionsData1="optionsData1"
            :optionsData2="optionsData2"
            :optionsData3="optionsData3"
            @inContentIntro="inShopnottro"
        ></popShopNotices>
        <!-- 产品展示 -->
        <popCommodityLabel
            ref="popCommodityLabel"
            :idyun="idyun"
            :form="form"
        ></popCommodityLabel>
        <!-- 运费设置 -->
        <popFreightSet
            ref="popFreightSet"
            :idyun="idyun"
            :form="form2"
            :data_list="freight_ls"
            @getlistFun="getSfeetunlist"
        ></popFreightSet>
        <el-drawer
            title="插入图片"
            :visible.sync="is_drawer1"
            class="drawer-box"
            @close="closePopInsertImgTxt(action.images)"
        >
            <popInsertImg
                ref="popInsertImg"
                :is_drawer="is_drawer1"
                :idyun="idyun"
            ></popInsertImg>
        </el-drawer>
        <el-drawer
            title="插入图文"
            :visible.sync="is_drawer2"
            class="drawer-box"
            @close="closePopInsertImgTxt(action.imageTxt)"
        >
            <popInsertImgTxt
                ref="popInsertImgTxt"
                :is_drawer="is_drawer2"
                :idyun="idyun"
            ></popInsertImgTxt>
        </el-drawer>
        <el-drawer
            title="店铺轮播图设置"
            :visible.sync="is_drawer3"
            class="drawer-box"
        >
            <popCarouselchart
                ref="popCarouselchart"
                :is_drawer="is_drawer3"
                :idyun="idyun"
                :form="form"
                @jumpLink="jumpLink"
            ></popCarouselchart>
        </el-drawer>
        <el-drawer
            title="快速导航设置"
            :visible.sync="is_drawer4"
            class="drawer-box"
        >
            <popQuickNavigation
                ref="popQuickNavigation"
                :is_drawer="is_drawer4"
                :idyun="idyun"
                :form="form"
                @jumpLink="jumpLink"
            ></popQuickNavigation>
        </el-drawer>
        <el-drawer
            title="活动展示设置"
            :visible.sync="is_drawer5"
            class="drawer-box"
        >
            <popEventdisplay
                ref="popEventdisplay"
                :is_drawer="is_drawer5"
                :idyun="idyun"
                :form="form"
                @jumpLink="jumpLink"
            ></popEventdisplay>
        </el-drawer>
    </div>
</template>

<script>
import addPhoto from "@/components/comm/AddPhoto.vue";
import imageCropper from "@/components/comm/ImageCropper.vue";
import popMappointSelection from "@/components/comm/popMappointSelection.vue";
import tengxunMapSelect from "@/components/comm/tengxunMapSelect.vue";
import popInsertTeam from "@/components/cloudShop/popInsertTeam.vue";
import popInsertImg from "@/components/cloudShop/popInsertImg.vue";
import popInsertImgTxt from "@/components/cloudShop/popInsertImgTxt.vue";
import popCarouselchart from "@/components/cloudShop/popCarouselchart.vue";
import popQuickNavigation from "@/components/cloudShop/popQuickNavigation.vue";
import popCommodityLabel from "@/components/cloudShop/popCommodityLabel.vue";
import popEventdisplay from "@/components/cloudShop/popEventdisplay.vue";
import popFreightSet from "@/components/cloudShop/popFreightSet.vue";
import popJumpLink from "@/components/cloudShop/popJumpLink.vue";
import popShopNotices from "@/components/cloudShop/popShopNotices.vue";
import config from "@/js/conf/Config.js";
import goPage from "@/js/GoPage.js";
import editCloudShop from "@/js/cloudShop/EditCloudShop.js";
import accessCtrl from "@/js/limit/AccessCtrl.js";
import localStore from "@/js/LocalStore.js";

let timeout = null;

export default {
    props: ["pageType"],
    components: {
        addPhoto,
        imageCropper,
        popMappointSelection,
        popInsertTeam,
        popInsertImg,
        popInsertImgTxt,
        popCarouselchart,
        popJumpLink,
        popShopNotices,
        popQuickNavigation,
        popEventdisplay,
        popCommodityLabel,
        popFreightSet,
        tengxunMapSelect,
    },
    computed: {},
    data() {
        return {
            is_yy: false, //服务权限
            is_good: false, //产品权限
            md: "", //企业模式
            is_xsqg: "", //限时优惠
            is_hdpt: "", //拼团
            is_tpbm: "", //投票报名
            action: editCloudShop.action,
            is_drawer1: false,
            is_drawer2: false,
            is_drawer3: false,
            is_drawer4: false,
            is_drawer5: false,
            activeName: "1", //顶部导航切换
            labelWidthall: "170px", //表单整体缩进
            highlight_i: "", //高亮标识
            idyun: "", //云店id
            editUrl: "", //裁剪图片
            batchid: "", //裁剪图片的下标
            optionsGoodpic: [], //产品的价格列表
            optionsProprepic: [], //服务的价格列表
            shippObj: {}, //配送方式对象
            shipp_ls: [], //配送方式
            pay_openls: [], //充值选项列表
            play_ls: [], //支付选项列表
            freight_ls: [], //运费列表
            optionsPosition: [], //省市区列表
            optionsData1: [], //字体大小选项
            optionsData2: [], //字体颜色选项
            optionsData3: [], //显示方式选项
            show_gd_price: "2", //新客户产品价格显示
            show_yy_price: "2", //新客户服务价格显示
            is_online_pay: "2", //在线支付开关
            shipp_now: "2", //门店自取开关

            form2: {
                id: "",
            }, //配送方式
            form: {
                id: "",
                // 云店信息
                logo: [
                    //云店logo
                    {
                        url: "",
                        urls: "",
                    },
                ],
                name: "", //店铺名称
                cellphone: "", //电话
                contacts: "", //联系人
                address_type: "2", //地址选点选项
                district: [], //省市区
                address: "", //详细地址
                jsnr_radio: "2", //介绍内容选项
                productIntr: [], //产品介绍
                // 营销设置
                lbt_select: 1, //轮播图数量
                ad: [
                    //轮播图数据
                ],
                dpgg_radio: "1", //店铺公告开关
                notice: {},
                nav_info: {
                    is_open: "1", //导航开关
                    show_type: "4", //导航显示方式
                },
                mar_info: {
                    is_open: "1", //活动开关
                    name: "", //活动名称
                    txt: "", //活动描述
                },
                tag_info: {
                    is_open: "1", //产品展示
                    ls: [], //产品展示标签列表
                },
                open_yk: "1", //向游客开放
                is_cellphone: "1", //登录手机必填

                is_price: "2", //老客户产品价格显示/隐藏
                isprice_pre: "2", //老客户产品上次价格
                price_i_yk: "", //新客户选中的产品价格段

                yy_is_price: "2", //老客户服务价格显示/隐藏
                yy_isprice_pre: "2", //老客户服务上次价格
                yy_price_i_yk: "", //新客户选中的服务价格段

                // 高级设置
                is_fqty: "1", //允许超过库存销售
                // is_pricec: "1", //是否划线价格
                is_number: "3", //显示销量
                is_qty: "2", //显示库存
                num_min: "", //产品起订量
                amount_min: "", //最低下单金额
                must_pay: "1", //下单必须支付
                now_out: "1", //下单后立即减库存
                od_in_sp_id: "", //选择门店
                od_in_st_id: "", //选择仓库
                isprint: "1", //下单支付后自动打印单据

                is_recharge: "2", //充值
                is_cash: "2", //提现
                payls: [], //支付方式
                shipp: [], //配送方式
                longitude: "", //经度
                latitude: "", //纬度
            },
            shopList: [],
            storeList: [],
            propsdata: {
                children: "cityList",
                label: "name",
                value: "code",
                expandTrigger: "hover",
                checkStrictly: true,
            },
            rules: {
                name: [
                    {
                        required: true,
                        message: "请输入店铺名称",
                        trigger: "blur",
                    },
                ],
                cellphone: [
                    {
                        required: true,
                        message: "请输入电话",
                        trigger: "blur",
                    },
                ],
            },
            addrDetail:'',
        };
    },

    created() {
        this.idyun = this.$geturl().idyun;
        this.getInfoData();
        this.getInfosetData();
        this.getSfeetunlist();
        this.getGdpricelist();
        this.getPrpricelist();
        this.setPermissions();
        uni.$on("edid_cloud_shop_cursor", (data) => {
            this.cursorHandler(data);
        });
    },
    mounted() {},
    methods: {
        getboll() {
            let boll = true;
            this.play_ls.map((v) => {
                this.form.payls.map((vs) => {
                    if (v.id > 21 && v.id == vs) {
                        boll = false;
                    }
                });
            });
            return boll;
        },
        /*****关闭插入图片,关闭插入图文*******/
        async closePopInsertImgTxt(act, isInit = 0) {
            let data = null;
            if (isInit == 0) {
                if (act == this.action.images)
                    data = this.$refs.popInsertImg.form;
                else if (act == this.action.imageTxt)
                    data = this.$refs.popInsertImgTxt.form;
                await this.setIntroduction(data);
                this.updateCarftImgTxt(act, data, isInit);
            } else {
                let index = 0;
                this.form.productIntr.forEach((s) => {
                    let a = "";
                    if (Number(s.type) == 1) {
                        a = this.action.team;
                    } else if (Number(s.type) == 2) {
                        a = this.action.images;
                    } else if (Number(s.type) == 3) {
                        a = this.action.imageTxt;
                    }
                    s.index = index;
                    this.updateCarftImgTxt(a, s, isInit);
                    index++;
                });
            }
        },
        updateCarftImgTxt(act, data, isInit) {
            if (data) {
                let temp = {};
                temp.index = data.index;
                temp.title = data.title;
                temp.type = data.type;
                temp.id = data.id;
                temp.info = [];
                if (data.info) {
                    let that = this;
                    data.info.forEach((s) => {
                        if (isInit == 0) {
                            if (s.img[0].url != "") {
                                let t = {};
                                t.imgs = s.img[0].url;
                                if (act == that.action.imageTxt)
                                    t.text = s.text;
                                temp.info.push(t);
                            } else if (s.type == 3 && s.text) {
                                let t = {};
                                t.text = s.text;
                                temp.info.push(t);
                            }
                        } else {
                            let t = {};
                            if (act == that.action.imageTxt) {
                                //图文
                                t.imgs = s.img[0].url;
                                t.text = s.text;
                                temp.info.push(t);
                            } else if (act == that.action.images) {
                                //图片
                                if (s.img[0].url) {
                                    t.imgs = s.img[0].url;
                                    temp.info.push(t);
                                }
                            } else if (act == that.action.team) {
                                //团队
                                t.imgs = s.img;
                                t.title = s.text;
                                temp.info.push(t);
                            }
                        }
                    });
                }
                let obj = { act: act, data: temp };
                this.updateTosimulator(obj);
            }
        },

        /*******团队内容*******/
        async inContentIntro(value) {
            if (!value.info || value.info.length == 0) return;
            await this.setIntroduction(value);
            let data = {};
            data.act = this.action.team;
            data.data = value;
            this.updateTosimulator(data);
        },
        // 公告内容
        inShopnottro() {
            let data = {};
            data.act = this.action.shopNotice;
            data.data = this.form.notice.text;
            this.updateTosimulator(data);
        },
        // 介绍内容编辑
        async setIntroduction(data) {
            let data2 = JSON.parse(JSON.stringify(data));
            let param = {
                idyun: this.idyun,
                moer_title: data2.title,
                moer_id: data2.moer_id || 0,
                type: data2.type,
            };
            if (data2.info && data2.info.length > 0) {
                if (data2.type == 1) {
                    // 团队的数据
                    param.info_id = [];
                    data2.info.map((v) => {
                        param.info_id.push(v.uid);
                    });
                } else if (data2.type == 2) {
                    // 图片的数据
                    param.info_img = [];
                    data2.info.map((v) => {
                        if (v.img[0].urls) {
                            param.info_img.push(v.img[0].urls);
                        }
                    });
                    param.info_img.join();
                } else {
                    // 图文的数据
                    param.info_json = [];
                    data2.info.map((v) => {
                        // if (v.img[0].urls) {
                        //     param.info_json.push({
                        //         imgs: v.img[0].urls,
                        //         img_rel: v.img[0].urls,
                        //         text: v.text,
                        //     });
                        // }
                        param?.info_json.push({
                            imgs: v.img[0].urls,
                            img_rel: v.img[0].urls,
                            text: v.text,
                        });
                    });
                }
            }
            let url = config.COMPSET_YUNSHOP_MOEREDIT;
            let res = await this.$api({ url: url, data: param });
            if (!res) return;
            if (res.status == 1) {
                this.$msg({ title: "保存成功" });
                this.getInfoData(true);
            }
        },
        /***输入框事件****/
        inputHandler(data) {
            this.testFun(this.updateTosimulator, data);
        },

        // 防抖
        testFun(fun, data, time = 500) {
            if (timeout) {
                clearTimeout(timeout); // 规定时间内若定时器存在则清除
            }
            timeout = setTimeout(() => {
                fun(data); // 调用接口
            }, time);
        },

        /****更新数据到模拟器*****/
        updateTosimulator(data) {
            editCloudShop.update(data);
        },

        /*****上传图片成功*****/
        uploadPicSuccess(index, name, result, batchid) {
            if (batchid === "enterprise_logo") {
                this.form.logo = [
                    {
                        url: result.url,
                        urls: result.name,
                    },
                ];
                this.updateLogo();
            }
        },

        /*******更新logo********/
        updateLogo() {
            let data = {};
            data.act = this.action.logo;
            data.data = this.form.logo[0];
            this.updateTosimulator(data);
        },

        // 左侧手机预览抛过来的数据
        cursorHandler(data) {
            this.highlight_i = data.act;
            if (this.highlight_i === this.action.shopNotice) {
                this.activeName = "2";
            } else {
                this.activeName = "1";
            }
            if (this.highlight_i == this.action.adress1) {
                this.form.address_type = "1";
            } else if (this.highlight_i == this.action.adress2) {
                this.form.address_type = "2";
            } else if (
                data.act == this.action.team ||
                data.act == this.action.images ||
                data.act == this.action.imageTxt
            ) {
                this.highlight_i = "context_intor_" + data.data; //这里指定，本来用index,怕重复，引起高亮重复
            } else if (data.act == this.action.moveTeamImgTxt) {
                //移动图文信息
                let temp = this.form.productIntr[data.data.index];
                let idx =
                    data.data.dire === "up"
                        ? data.data.index - 1
                        : data.data.index + 1;
                this.form.productIntr[data.data.index] =
                    this.form.productIntr[idx];
                this.form.productIntr[idx] = temp;
                this.highlight_i = "context_intor_" + idx;
                this.$forceUpdate();
            }
        },
        /*******上传头像*******/
        uploadAavatar(data, batchid) {
            this.editUrl = data.url;
            this.batchid = batchid;
        },
        /*****确认编辑图片****/
        confirm(data) {
            if (this.batchid === "enterprise_logo") {
                this.$refs.AddPhotoLogo.confirm(data, this.uploadPicSuccess);
            }
        },
        //图片取消上传
        cancel() {
            if (this.batchid === "enterprise_logo") {
                this.$refs.AddPhotoLogo.cancel();
            }
        },
        // 点击替换按钮
        replaceImg(url, index) {
            if (index === "enterprise_logo") {
                this.$refs.AddPhotoLogo.chooseImage({ url }, 0);
            }
        },
        // 选择省市区
        handleChange(e) {
            let district = this.getmapNameFun(e);
            district = district + this.form.address;
            let data = {};
            data.act = this.action.adress2;
            data.data = district;

            console.log("district=", district);
            console.log("data=", data);
            this.addrDetail = district;
            this.updateTosimulator(data);
        },
        // 获取省市区
        async getdistrictsData() {
            let param = {};
            let url = config.COMM_DISTRICTS;
            let res = await this.$api({ url: url, data: param });
            if (!res) return;
            if (res.status == 1 && res.data) {
                this.optionsPosition = res.data;
                this.handleChange(this.form.district);
            }
        },
        // 地图经纬度
        mapLnglat(data) {
            console.log("data地图经纬度--=", data);
            this.form.longitude = data.lng;
            this.form.latitude = data.lat;
        },
        // 获取云店设置详情
        async getInfosetData() {
            let url = config.COMPSET_YUNSHOPSET_INFO;
            let param = {
                id: this.idyun,
            };
            let res = await this.$api({ url: url, data: param });
            if (!res) return;
            if (res.status == 1) {
                if (res.data.pay_openls) {
                    // 充值赋值
                    res.data.pay_openls.map((v) => {
                        this.form[v.id] = v.is_ck;
                    });
                    this.pay_openls = res.data.pay_openls;
                }
                if (res.data.play_ls) {
                    this.play_ls = res.data.play_ls;
                }
                // 格式详情数据
                if (res.data.shopset_info) {
                    const form = this.form;
                    const info = res.data.shopset_info;
                    if (info.shop_ls) {
                        this.shopList = info.shop_ls;
                    }
                    if (info.store_ls) {
                        this.storeList = info.store_ls;
                    }

                    // 轮播图
                    if (info.ad) {
                        this.form.lbt_select = info.ad.length;
                        info.ad.map((v) => {
                            form.ad.push({
                                gd_id: v.gd_id,
                                gd_name: v.gd_name,
                                img: [
                                    {
                                        url: v.gd_img,
                                        urls: v.gd_img_rel,
                                    },
                                ],
                                gd_txt: v.gd_txt,
                                gd_type: v.gd_type,
                            });
                        });
                    } else {
                        form.ad = [
                            {
                                img: [
                                    {
                                        url: "",
                                        urls: "",
                                    },
                                ],
                                gd_id: "",
                                gd_name: "",
                                gd_type: "",
                            },
                        ];
                    }
                    // 公告
                    this.optionsData1 = info.notice2.size_ls;
                    this.optionsData2 = info.notice2.color_ls;
                    this.optionsData3 = info.notice2.stype_ls;
                    form.notice = info.notice2.notice;
                    form.dpgg_radio = info.notice2.notice.text ? "1" : "2";
                    // 导航
                    form.nav_info = info.nav_info;
                    // 营销活动
                    form.mar_info = info.mar_info;
                    // 产品标签
                    form.tag_info = info.tag_info;

                    // 访问设置
                    form.open_yk = info.open_yk;
                    form.is_cellphone = info.is_cellphone;
                    if (info.isprice_pre == 1) {
                        form.is_price = "3";
                    } else {
                        form.is_price = info.is_price;
                    }
                    if (info.price_i_yk == 0) {
                        this.show_gd_price = "2";
                    } else {
                        this.show_gd_price = "1";
                        form.price_i_yk = info.price_i_yk;
                    }
                    if (info.yy_isprice_pre == 1) {
                        form.yy_is_price = "3";
                    } else {
                        form.yy_is_price = info.yy_is_price;
                    }
                    if (info.yy_price_i_yk == 0) {
                        this.show_yy_price = "2";
                    } else {
                        this.show_yy_price = "1";
                        form.yy_price_i_yk = info.yy_price_i_yk;
                    }

                    // 销售设置
                    form.is_fqty = info.is_fqty;
                    form.is_number = info.is_number;
                    form.is_qty = info.is_qty;
                    form.num_min = info.num_min;
                    form.amount_min = info.amount_min;
                    form.must_pay = info.must_pay;
                    form.now_out = info.now_out;
                    form.od_in_sp_id = info.od_in_sp_id;
                    form.od_in_st_id = info.od_in_st_id;
                    form.isprint = info.isprint;

                    // 支付设置
                    info.payls.map((v) => {
                        form.payls.unshift(Number(v));
                    });

                    if (this.play_ls) {
                        this.play_ls.map((v) => {
                            info.payls.map((vs) => {
                                if (v.id < 22 && v.id == vs) {
                                    this.is_online_pay = "1";
                                }
                            });
                        });
                    }
                    // 配送设置
                    if (info.shipp_ls) {
                        info.shipp_ls.map((v) => {
                            if (v.type == 1) {
                                this.shippObj = {
                                    name: v.title,
                                    id: v.id,
                                };
                            }
                        });
                        this.shipp_ls = info.shipp_ls;
                    }
                    this.form.shipp = info.shipp.split(",");
                    if (this.form.shipp.length > 0) {
                        this.form.shipp.map((v) => {
                            if (this.shippObj.id == v) {
                                this.shipp_now = "1";
                            }
                        });
                    }
                }
                this.inShopnottro(); //左侧公告初始赋值
            }
        },
        // 设置权限
        async setPermissions() {
            this.is_yy = await accessCtrl.getAboutLimit();
            this.is_good =
                (await accessCtrl.getSaleLimit()) &&
                (await accessCtrl.getGoodsLimit());
            this.is_xsqg = await accessCtrl.getDiscountLimit();
            this.is_hdpt = await accessCtrl.getSgortDoughLimit();
            this.is_tpbm = await accessCtrl.getLimitMarketingTpBm();
            this.md = localStore.getCpInfo().md;
        },
        // 获取云店信息详情
        async getInfoData(is_moer = false) {
            let url = config.COMPSET_YUNSHOP_INFO;
            let param = {
                id: this.idyun,
            };
            let res = await this.$api({ url: url, data: param });
            if (!res) return;
            if (res.status == 1) {
                // 云店基本详情
                if (res.data.base && !is_moer) {
                    const f = this.form;
                    const b = res.data.base;
                    f.id = b.id;
                    f.logo = [
                        {
                            url: b.logo,
                            urls: b.logo_rel,
                        },
                    ];
                    f.name = b.name;
                    f.cellphone = b.cellphone;
                    f.contacts = b.contacts;
                    f.district = [b.province, b.city, b.area];
                    f.address = b.address;
                }
                // 云店介绍详情
                if (res.data.moer) {
                    res.data.moer.map((v) => {
                        if (v.type == 3) {
                            if (v.info) {
                                v.img_txt = v.info.length;
                            } else {
                                v.img_txt = 1;
                            }
                        }
                        if (v.type == 2 || v.type == 3) {
                            v.info2 = [];
                            if (v.info) {
                                v.info.map((vs) => {
                                    v.info2.push({
                                        img: [
                                            {
                                                url: vs.imgs,
                                                urls: vs.img_rel,
                                            },
                                        ],
                                        text: vs.text ? vs.text : "",
                                    });
                                });
                            } else {
                                v.info2.push({
                                    img: [
                                        {
                                            url: "",
                                            urls: "",
                                        },
                                    ],
                                    text: "",
                                });
                            }
                        }
                    });
                    res.data.moer.map((v) => {
                        if (v.type == 2 || v.type == 3) {
                            v.info = v.info2;
                            delete v.info2;
                        }
                        if (v.type == 2) {
                            v.info.push({
                                img: [
                                    {
                                        url: "",
                                        urls: "",
                                    },
                                ],
                            });
                        }
                    });
                    this.form.productIntr = res.data.moer;
                }
                this.getdistrictsData();

                //更新到模拟器
                this.updateLogo(); //logo

                this.updateTosimulator({
                    //店铺名称
                    act: this.action.shopName,
                    data: { name: this.form.name },
                });
                this.updateTosimulator({
                    //电话
                    act: this.action.phone,
                    data: { cellphone: this.form.cellphone },
                });
                this.updateTosimulator({
                    //联系人
                    act: this.action.contacts,
                    data: { contacts: this.form.contacts },
                });

                this.closePopInsertImgTxt("", 1); //初始化数据
            }
        },
        // 格式提交的云店设置信息
        setInfoFormat(form) {
            delete form.nav_info.ls;
            delete form.mar_info.ls;
            delete form.tag_info.ls;
            let obj = {
                id: this.idyun,
                ad: [], //轮播图
                notice: form.notice, //店铺公告
                open_yk: form.open_yk,
                is_cellphone: form.is_cellphone,
                price_i_yk: form.price_i_yk,
                yy_price_i_yk: form.yy_price_i_yk,
                is_fqty: form.is_fqty,
                is_number: form.is_number,
                is_qty: form.is_qty,
                num_min: form.num_min,
                amount_min: form.amount_min,
                must_pay: form.must_pay,
                now_out: form.now_out,
                od_in_sp_id: form.od_in_sp_id,
                od_in_st_id: form.od_in_st_id,
                isprint: form.isprint,
                is_cash: form.is_cash,
                is_recharge: form.is_recharge,
            };
            form.ad.map((v) => {
                obj.ad.push({
                    gd_id: v.gd_id,
                    gd_img: v.img[0].urls,
                    gd_img_big: v.img[0].url,
                    gd_img_rel: v.img[0].urls,
                    gd_img_show: v.img[0].url,
                    gd_name: v.gd_name,
                    gd_txt: v.gd_txt || "",
                    gd_type: v.gd_type,
                });
            });
            if (this.md === "asm") {
                obj.nav_info = form.nav_info; //快速导航
                obj.mar_info = form.mar_info; //营销活动
                obj.tag_info = form.tag_info; //产品标签
            }
            if (this.is_yy) {
                if (form.yy_is_price == 3) {
                    obj.yy_is_price = 1;
                    obj.yy_isprice_pre = 1;
                } else if (form.yy_is_price == 1) {
                    obj.yy_is_price = 1;
                    obj.yy_isprice_pre = 2;
                } else {
                    obj.yy_is_price = 2;
                    obj.yy_isprice_pre = 2;
                }
            }
            if (this.is_good) {
                if (form.is_price == 3) {
                    obj.is_price = 1;
                    obj.isprice_pre = 1;
                } else if (form.is_price == 1) {
                    obj.is_price = 1;
                    obj.isprice_pre = 2;
                } else {
                    obj.is_price = 2;
                    obj.isprice_pre = 2;
                }
            }
            if (this.md !== "asm") {
                if (this.is_online_pay == 2) {
                    this.play_ls.map((v) => {
                        form.payls.map((vs, vi) => {
                            if (v.id < 22 && v.id == vs) {
                                form.payls.splice(vi, 1);
                            }
                        });
                    });
                }
                obj.payls = form.payls.join();
            }

            if (this.shipp_now == 2) {
                form.shipp.map((v, i) => {
                    if (this.shippObj.id == v) {
                        form.shipp.splice(i, 1);
                    }
                });
            }
            obj.shipp = form.shipp.join();
            return obj;
        },
        // 获取运费方式列表
        async getSfeetunlist() {
            let url = config.COMPSET_SFEEYUN_LS;
            let param = {
                id: this.idyun,
            };
            let res = await this.$api({ url: url, data: param });
            if (!res) return;
            if (res.status == 1 && res.data) {
                res.data.map((v) => {
                    if (v.status == 1) {
                        this.form2.id = v.id;
                    }
                    if (v.type == 1) {
                        v.typei = 1;
                    } else if (v.type == 2) {
                        v.typei = 3;
                    } else {
                        v.typei = 2;
                    }
                });
                this.freight_ls = res.data;
                this.freight_ls.sort((a, b) => {
                    return a.typei - b.typei;
                });
            }
        },
        // 获取产品价格段
        async getGdpricelist() {
            let url = config.GDPRE_PRICE_LSR;
            let param = {};
            let res = await this.$api({ url: url, data: param });
            if (!res) return;
            if (res.status == 1 && res.data) {
                this.optionsGoodpic = res.data;
                this.form.price_i_yk = res.data[0].psort;
            }
        },
        // 获取服务价格段
        async getPrpricelist() {
            let url = config.PROPRE_PRICE_LS;
            let param = {
                status: "1",
            };
            let res = await this.$api({ url: url, data: param });
            if (!res) return;
            if (res.status == 1 && res.data.price_ls) {
                this.optionsProprepic = res.data.price_ls;
                if (this.form.yy_price_i_yk == 0 || !this.form.yy_price_i_yk) {
                    this.form.yy_price_i_yk = res.data.price_ls[0].psort;
                }
            }
        },
        // 保存
        async submitFun() {
            await this.saveydInfoFun();
            await this.savefreightFun();
            await this.saveydSetInfoFun();
        },
        // 保存云店设置信息
        async saveydSetInfoFun() {
            let param = JSON.parse(JSON.stringify(this.form));
            param = this.setInfoFormat(param);
            let url = config.COMPSET_YUNSHOPSET_SAVE;
            let res = await this.$api({ url: url, data: param });
            if (res.status == 1) {
                this.$msg({ title: "保存成功" });
                setTimeout(() => {
                    if (this.pageType == 1) {
                        goPage.goNavTo(`/pages/cloudStoreList/index`);
                    }
                }, 1000);
            }
        },
        // 保存云店信息
        async saveydInfoFun() {
            let param = {
                address: this.form.address,
                area: this.form.district[2] || "",
                cellphone: this.form.cellphone,
                city: this.form.district[1] || "",
                contacts: this.form.contacts,
                district: "",
                id: this.idyun,
                logo: this.form.logo[0].urls,
                name: this.form.name,
                province: this.form.district[0] || "",
                longitude: this.form.longitude,
                latitude: this.form.latitude,
            };
            param = JSON.parse(JSON.stringify(param));
            param.district = this.getmapNameFun(this.form.district);
            let url = config.COMPSET_YUNSHOP_EDIT;
            await this.$api({ url: url, data: param });
        },
        // 保存运费信息
        async savefreightFun() {
            let param = {
                id: this.form2.id,
            };
            let url = config.COMPSET_SFEEYUN_CHECK;
            await this.$api({ url: url, data: param });
        },
        // 获取地址名称
        getmapNameFun(arr) {
            let name = "";
            const province = arr[0] | "";
            const city = arr[1] | "";
            const area = arr[2] | "";
            if (province) {
                this.optionsPosition.map((v) => {
                    if (province == v.code) {
                        name += v.name;
                        if (city) {
                            v.cityList.map((vs) => {
                                if (city == vs.code) {
                                    name += vs.name;
                                    if (area) {
                                        vs.cityList.map((vw) => {
                                            if (area == vw.code) {
                                                name += vw.name;
                                            }
                                        });
                                    }
                                }
                            });
                        }
                    }
                });
            }
            return name;
        },
        // 打开地地图选择器
        openMapFun() {
            this.$refs.popMappointSelection.initData();
        },
        // 插入介绍
        insertFun(type) {
            if (type == 1) {
                //插入团队
                this.form.productIntr.push({
                    moer_id: "",
                    title: `团队信息${this.form.productIntr.length + 1}`, //自定义名称
                    type: type,
                    info: [], //选中的成员
                });
            } else if (type == 2) {
                // 插入图片
                this.form.productIntr.push({
                    moer_id: "",
                    title: `图片信息${this.form.productIntr.length + 1}`, //自定义名称
                    type: type,
                    info: [
                        {
                            img: [
                                {
                                    url: "",
                                    urls: "",
                                },
                            ],
                        },
                    ],
                });
            } else {
                //插入图文
                this.form.productIntr.push({
                    moer_id: "",
                    title: `图文信息${this.form.productIntr.length + 1}`, //自定义名称
                    type: type,
                    img_txt: 1, //图文数量
                    info: [
                        {
                            img: [
                                {
                                    url: "",
                                    urls: "",
                                },
                            ],
                            text: "",
                        },
                    ],
                });
            }
        },
        // 查看介绍设置
        setupFun(data, index) {
            data.index = index;
            if (data.type == 1) {
                //查看团队
                this.$refs.popInsertTeam.initData(data);
            } else if (data.type == 2) {
                //查看图片
                this.is_drawer1 = true;
                setTimeout(() => {
                    this.$refs.popInsertImg.initData(data);
                }, 200);
            } else {
                //查看图片
                this.is_drawer2 = true;
                setTimeout(() => {
                    this.$refs.popInsertImgTxt.initData(data);
                }, 200);
            }
        },
        // 删除介绍
        delFun(item, index) {
            if (item.moer_id) {
                this.$confirm(`是否删除 ${item.title}?`, "删除", {
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    type: "warning",
                })
                    .then(async () => {
                        let param = {
                            moer_id: item.moer_id,
                            idyun: this.idyun,
                        };
                        let url = config.COMPSET_YUNSHOP_MOERDEL;
                        let res = await this.$api({ url: url, data: param });
                        if (!res) return;
                        if (res.status == 1) {
                            this.$msg({ title: "删除成功" });
                            this.form.productIntr.splice(index, 1);
                            let data = {};
                            data.act = this.action.delTeamImgTxt;
                            data.data = { index: index };
                            this.updateTosimulator(data);
                        }
                    })
                    .catch(() => {});
            } else {
                this.form.productIntr.splice(index, 1);
                let data = {};
                data.act = this.action.delTeamImgTxt;
                data.data = { index: index };
                this.updateTosimulator(data);
            }
        },
        // 打开店铺轮播图设置
        openOrganizer() {
            this.is_drawer3 = true;
        },
        // 打开店铺公告设置
        openShopNotices() {
            this.$refs.popShopNotices.is_drawer = true;
        },
        // 打开快速导航设置
        openQuickNavigation() {
            this.is_drawer4 = true;
            setTimeout(() => {
                this.$refs.popQuickNavigation.initData();
            }, 200);
        },
        // 打开营销活动设置
        openEventdisplay() {
            this.is_drawer5 = true;
            setTimeout(() => {
                this.$refs.popEventdisplay.initData();
            }, 200);
        },
        // 打开产品展示设置
        openCommodityLabel() {
            this.$refs.popCommodityLabel.initData();
        },
        setfreightFun() {
            this.$refs.popFreightSet.initData();
        },
        // 选择跳转路径
        jumpLink(data) {
            this.$refs.popJumpLink.initData(data);
        },
    },
};
</script>

<style lang="scss" scoped >
.setup-form {
    width: calc(100% - 500px);
    height: 100%;
    font-size: 14px;
    background: #fff;
    position: relative;
    ::v-deep.el-tabs {
        height: 100%;

        .el-tabs__nav-scroll {
            padding: 0 10px;
        }

        .el-tabs__item {
            font-size: 18px;
        }
    }

    .highlight {
        padding: 5px;
        box-shadow: rgb(245, 154, 35) 0px 0px 20px;
    }
    .el-form {
        height: calc(100% - 60px);
        .set-population {
            color: #3989fc;
            cursor: pointer;
            margin-left: 10px;
            &.cha-sl {
                margin: 0;
            }
        }
        // .el-radio {
        //     &.is-checked {
        //         .el-radio__label {
        //             color: #606266;
        //         }
        //     }
        // }
        ::v-deep.tab-box {
            height: calc(100vh - 150px);
            padding: 0 10px;
            &.good-tab-box {
                position: relative;
                .el-tabs__header {
                    padding-right: 100px;
                }
                .good-add-box {
                    position: absolute;
                    top: 5px;
                    right: 10px;
                    z-index: 999;
                    .el-button--mini {
                        padding: 7px 10px;
                    }
                }
            }
            .tis {
                font-size: 12px;
                color: #999;
                line-height: 20px;
                &.ml-tis {
                    margin-left: 20px;
                }
            }
            .module-title {
                padding-bottom: 10px;
                border-bottom: 1px solid #797979;
                margin-bottom: 20px;
            }
            .input-w {
                i {
                    font-size: 18px;
                    font-weight: bold;
                    color: #000;
                    cursor: pointer;
                }
            }
            .form-mb {
                margin-bottom: 10px;
            }
            .input-w-200 {
                width: 200px;
                margin-right: 10px;
                margin-bottom: 10px;
            }
            .input-w-400 {
                margin-top: 10px;
                width: 400px;
            }
            .inpit-xz {
                width: 60px;
                margin: 0 5px;
            }
            .radio-mr {
                margin-right: 58px;
            }
            .txt-xg {
                margin-left: 20px;
            }
            .text-lr {
                margin: 0 10px;
            }
            .checkbox-mr {
                margin-right: 10px;
            }
            .tis {
                color: #aaa;
                font-size: 12px;
            }
            .label-title {
                .title {
                    margin-right: 5px;
                }
                .stars {
                    color: #f56c6c;
                    margin-right: 3px;
                }
            }
            .txt-left {
                .el-form-item__label {
                    text-align: left;
                }
            }
            .sessions-row {
                max-width: 516px;
                .sessions-title {
                    span {
                        margin-right: 5px;
                    }
                    .status {
                        padding: 2px 10px;
                        border-radius: 30px;
                        background: #ea7f8e;
                        color: #fff;
                        &.acitve {
                            background: #eab468;
                        }
                    }
                }
                .sessions-info {
                    border-radius: 5px;
                    background: #f2f2f2;
                    padding: 20px;
                    border: 1px solid #d7d7d7;
                    .date-box {
                        margin-bottom: 10px;
                    }
                    .good-box {
                        display: flex;
                        flex-wrap: wrap;
                        margin-bottom: 10px;
                        .good-row {
                            margin-bottom: 10px;
                            padding: 0 10px;
                            border: 1px solid #d7d7d7;
                            border-radius: 3px;
                            margin-right: 10px;
                            line-height: 30px;
                            &:last-child {
                                margin-right: 0;
                            }
                        }
                    }
                }
            }
            .hide-required {
                .el-form-item__label {
                    &::before {
                        display: none;
                    }
                }
            }
            .img-context {
                display: flex;
                align-content: flex-end;
                &.gj-box {
                    border-radius: 5px;
                    border: 1px solid #d7d7d7;
                    padding: 10px;
                }
                .img-box {
                    width: 100px;
                    height: 100px;
                    margin-right: 20px;
                    .uploader-box {
                        margin: 0;
                    }
                }
                .img-but {
                    .tis {
                        margin-top: 20px;
                        font-size: 12px;
                        color: #999;
                    }
                }
            }
            .df-form-content {
                display: flex;
                justify-content: space-between;
                .but-tj {
                    // margin-left: 20px;
                    .el-dropdown {
                        margin-left: 10px;
                    }
                }
            }
            .content-row {
                span {
                    margin-right: 20px;
                }

                .del {
                    cursor: pointer;
                    color: #f36b6e;
                }
            }
            .see {
                cursor: pointer;
                color: #459ffd;
            }
        }
    }
    .but-box {
        position: absolute;
        left: 0;
        bottom: 0;
        background: #e6e6e6;
        width: calc(100% - 10px);
        padding: 10px 0;
        padding-right: 10px;
        // padding-bottom: 15px;
        text-align: right;
        z-index: 999;
    }
}
</style>
